<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/index.css" />
    <link rel="stylesheet" type="text/css" href="../../css/mine.css" />
    <link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_546019_o8qxm6fupb0ggb9.css" />
    <title>我的</title>
    <script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
    <!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;">
				<img src="../../img/left.png" class="left" />
				<span>我的</span>
			</div>
		</div>-->
    <div class="mine-content" style="margin-top: 0;">
        <div class="company-name">
            <p>
                <span class="names"></span>
                <img src="../../img/right.png" />
            </p>
            <p style="height: auto;">
                <span class="main-type"></span>
            </p>
        </div>
        <div class="tlg">

        </div>
        <!--<div class="uploaded">
				<span>待上传信息</span>
				<a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_primary Login" style="float: right;background: #28c81e;">待上传信息（2）</a>
			</div>-->
        <!--信息列表 -->
        <ul class="order-list">
            <!--<li>
						<p class="first_p">
							<span>HSGFG6500234982298</span>							
						</p>
						<p class="second_p">
							<span class="time">2017/06/28 10:35:45</span>						
						</p>
						<p class="third_p">
							<span>确认运输完毕</span>
							<span>待确认价格</span>
						</p>
						<img src="../../img/right.png"/>
				</li>-->
        </ul>
    </div>
    <!--<div class="weui-loadmore" style="margin-bottom: 2.5rem;">
			<i class="weui-loading"></i>
			<span class="weui-loadmore__tips">正在加载</span>
		</div>-->
    <div id="footer">
        <div class="weui-tabbar" style="position: fixed;">
            <!-- <a href="../demand/demand.html" data-info='1' class="weui-tabbar__item">
					<div class="weui-tabbar__icon">
						<img src="../../img/foot1.png" class="show" />
					</div>
					<p class="weui-tabbar__label">需求</p>
				</a>
				<a href="../information/information.html" data-info='2' class="weui-tabbar__item">
					<div class="weui-tabbar__icon">
						<img src="../../img/foot2.png" class="show" />
					</div>
					<p class="weui-tabbar__label">资讯</p>
				</a> -->
            <a href="../../index.html" data-info='6' class="weui-tabbar__item">
                <div class="weui-tabbar__icon">
                    <img src="../../img/foot6.png" class="show" />
                </div>
                <p class="weui-tabbar__label">首页</p>
            </a>
            <a href="../order/applyPay.html" data-info='7' class="weui-tabbar__item">
                <div class="weui-tabbar__icon">
                    <img src="../../img/foot7.png" class="show" />
                </div>
                <p class="weui-tabbar__label">付款</p>
            </a>
            <a href="../order/orderList.html" data-info='3' class="weui-tabbar__item ">
                <div class="weui-tabbar__icon">
                    <img src="../../img/foot3.png" class="show" />
                </div>
                <p class="weui-tabbar__label">订单</p>
            </a>
            <a href="mine.html" data-info='4' class="weui-tabbar__item weui-bar__item--on">
                <div class="weui-tabbar__icon">
                    <img src="../../img/footgreen4.png" class="show" />
                </div>
                <p class="weui-tabbar__label">我的</p>
            </a>
        </div>
    </div>
</body>
<script type="text/javascript">
    $(document).ready(function() {
        $(".company-name .names").html(localStorage.getItem("name"))
        $(".company-name .main-type").html(localStorage.getItem("scopeBusinessNames"))
        baseConfig.historyBack();
        $.showLoading("加载中...");
        $(".company-name").on("click", function() {
            location.href = "mineInformation.html"
        })
        var fn = {};
        fn.status = function(num) {
            if (num == 1 || num == 2 || num == 3 || num == 4 || num == 8) {
                return "#fdb96e"
            }
            if (num == 5) {
                return "#f65555"
            }
            if (num == 6) {
                return "#777777"
            }
            if (num == 7) {
                return "#28c81e"
            }
        }
        fn.status2 = function(status) {
            if (status == "待提交") {
                return "28c81e"
            }
            if (status == "待确认价格" || status == "待运输") {
                return "#fdb96e"
            }
        }
        fn.status3 = function(num) {
            switch (num) {
                case "1":
                    return "补充图片";
                case "2":
                    return "上传报价单";
                case "3":
                    return "上传合同";
                case "4":
                    return "上传车辆信息";
                case "5":
                    return "确认过磅单";
                case "6":
                    return "确认运输完毕";
                case "7":
                    return "确认入库单";
                case "8":
                    return "上传快递单"
            }
        }

        function clickGo(status, orderNo, orderid) {
            if (status == 1) {
                location.href = "../order/waitsubmitOrder.html?orderid=" + orderid + "&status=2"
            }
            if (status == 2) {
                //上传报价单
                location.href = "quotation.html?orderNo=" + orderNo + "&status=2"
            }
            if (status == 3) {
                //上传合同
                location.href = "signingContract.html?orderNo=" + orderNo + "&status=2"
            }
            if (status == 4) {
                //上传车辆信息
                location.href = "transportList.html?orderNo=" + orderNo + "&status=2"
            }
            if (status == 5) {
                //确认过磅单
                location.href = "ponderationList.html?orderNo=" + orderNo + "&status=2"
            }
            if (status == 6) {
                //确认运输完毕
                location.href = "transportCompletion.html?orderNo=" + orderNo + "&status=2"
            }
            if (status == 7) {
                //确认入库单
                location.href = "confirmwarehouseReceipt.html?orderNo=" + orderNo + "&status=2"
            }
            if (status == 8) {
                //上传快递单
                location.href = "uploadExpress.html?orderNo=" + orderNo + "&status=2"
            }
        }
        var phone = localStorage.getItem("username")
        if (!phone) {
            baseConfig.login()
        } else {
            var code = baseConfig.GetQueryString("code")
            if (!code) {
                code = ""
            }
            $.ajax({
                type: "get",
                url: baseConfig.localHttp + "weChatApi/fgclient/getMineList",
                async: false,
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                data: {
                    clientId: baseConfig.login(),
                    openid: code,
                    phone: phone
                },
                success: function(data) {
                    console.log(data)
                    $.hideLoading();
                    if (data.code == 100) {
                        var content = data.content
                        var $li = ""
                        for (var i = 0; i < content.length; i++) {
                            $li += "<li data-status=" + content[i].status + " data-orderid=" + content[i].orderId + " data-orderNo=" + content[i].orderNo + "><p class='first_p'><span>" +content[i].orderNo + "</span></p>"
                            if (!content[i].orderSubmitTime) {
                                content[i].orderSubmitTime = ""
                            }
                            if(content[i].orderType==0){
                            	$li += "<p class='second_p'><span class='time'>" + content[i].orderSubmitTime.slice(0, 10) + "</span></p>"
                            }else{
                            	$li += "<p class='second_p'><span class='time'>" + content[i].orderSubmitTime.slice(0, 19) + "</span></p>"
                            }       
                            $li += "<p class='third_p'><span style='color:" + fn.status(content[i].status) + ";border-color:" + fn.status(content[i].status) + "'>" + fn.status3(content[i].status) + "</span><span style='color:" + fn.status2(content[i].fgOrderStatus) + ";border-color:" + fn.status2(content[i].fgOrderStatus) + "'>" + content[i].fgOrderStatus + "</span></p><img src='../../img/right.png'/></li>"
                        }
                        $(".order-list").append($li);
                        for (var j = 0; j < $(".order-list li").length; j++) {
                            $(".order-list li").eq(j).on("click", function() {
                                var status = $(this).attr("data-status");
                                var orderNo = $(this).attr("data-orderNo");
                                var orderid = $(this).attr("data-orderid")
                                clickGo(status, orderNo, orderid)
                            })
                        }
                    } else {
                        $.toptip(data.content, 1200, 'error');
                    }
                },
                error: function() {
                    $.hideLoading();
                    $.toast("请求失败", "cancel");
                }
            })
        }
    })
</script>

</html>